#!/bin/bash

PID=${1:?"Please specific a PID."}

if [ $UID -ne 0 ]; then
	echo "Need to be root."
	exit 1
fi

while [ -d "/proc/$PID" ]; do
	sleep 3
done

echo "Job done.Will halt in 10 secs.Press Ctrl-C to interrupt."
sleep 10
poweroff
